package com.showsu.editor.config;

import com.showsu.editor.interceptor.UserSessionInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: William
 * @Description:
 * @Date: Created in 2:38 下午 2024/9/13
 * @Modified By:
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 设置拦截的路径、不拦截的路径、优先级等等
        registry.addInterceptor(new UserSessionInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns(
                        "/api/user/identifycode",
                        "/api/user/login",
                        "/api/user/wechat/login/qrcode",
                        "/api/user/wechat/login",
                        "/api/vip/info/list",
                        "/api/pay/alipay/notify/order",
                        "/api/manage/giveVip2User",
                        "/api/manage/editor/template/title",
                        "/api/xhs/editor/aweme/preview/**",
                        "/api/xhs/editor/aweme/shareConfig/**"
                        );
    }
}
